Vehicle Information
This section documents the vehicle information services available in the codebase, including IMEI checkers, car APIs, motorcycle APIs, and VIN decoders.
Table of Contents
IMEI Checkers
IMEIApiChecker
File: models/imeiapi/imeiapi.py
This module provides a client for checking IMEI numbers against the IMEIApi.net service.
Initialization
from models.imeiapi.imeiapi import IMEIApiChecker
# Initialize with API key from environment variable
imei_checker = IMEIApiChecker() # Uses IMEI_API_NET_KEY from environment
# Or specify API key directly
imei_checker = IMEIApiChecker(api_key="your_api_key_here")
# Customize retry behavior
imei_checker = IMEIApiChecker(
api_key="your_api_key_here",
timeout=10, # Seconds
max_retries=3
)
Check IMEI
# Check an IMEI number
imei_to_check = "123456789012345"
result = imei_checker.check_imei(imei_to_check)
if result:
print("IMEI check successful:", result)
else:
print("IMEI check failed or IMEI is invalid.")
IMEIDBClient
File: models/imeidb/imeidb.py
This module provides a client for the IMEIDB.xyz API, which offers device information based on IMEI numbers.
Initialization
from models.imeidb.imeidb import ImeiDBClient
# Initialize with API key from environment variable
client = ImeiDBClient() # Uses IMEIDB_XYZ_KEY from environment
# Or specify API key directly
client = ImeiDBClient(token="your_api_key_here")
# Specify response format
client = ImeiDBClient(response_format=ImeiDBClient.FORMAT_JSON) # or FORMAT_XML
Get Account Balance
# Get account balance
balance_info = client.get_balance()
print(balance_info)
Decode IMEI
# Get device information from IMEI
imei = "123456789012345"
device_info = client.get_decode(imei)
print(device_info)
# Specify device type for better accuracy
device_info = client.get_decode(imei, device_type="Smartphone")
IMEIInfoAPI
File: models/imeiinfo/imeiinfo.py
This module provides a client for the IMEI.info API.
Initialization
from models.imeiinfo.imeiinfo import IMEIInfoAPI
# Initialize with API key from environment variable
api = IMEIInfoAPI() # Uses IMEI_INFO_API_KEY from environment
# Or specify API key directly
api = IMEIInfoAPI(api_key="your_api_key_here")
Get Account Details
# Get account details
account = api.get_account_details()
print(account)
Check IMEI
# Check an IMEI with a specific service
service_id = "your_service_id"
imei = "123456789012345"
check_result = api.check_imei(service_id, imei)
print(check_result)
Search History
# Get search history
history = api.get_search_history()
print(history)
# Get details of a specific search
search_id = "your_search_id"
detail = api.get_search_history_detail(search_id)
print(detail)
IMEIorg
File: models/imeiorg/imeiorg.py
This module provides a client for the IMEI.org API service.
Initialization
from models.imeiorg.imeiorg import IMEIorg
# Initialize with API key from environment variable
imei_org = IMEIorg() # Uses IMEI_ORG_KEY from environment
Get Service List
# Get list of available services
service_list = imei_org.get_service_list()
print(service_list)
Place Order
# Place an order to check IMEI
service_id = "your_service_id"
imei = "123456789012345"
order_response = imei_org.place_order(service_id, imei)
print(order_response)
Get Order ID Asynchronously
# Get order ID for asynchronous processing
order_id_response = imei_org.get_order_id(service_id, imei)
print(order_id_response)
Track Order
# Track an order
order_id = "your_order_id"
track_response = imei_org.track_order(order_id)
print(track_response)
Check Balance
# Check account balance
balance = imei_org.check_balance()
print(balance)
IMEIToModel
File: models/imeitomodel/imeitomodel.py
This module provides a client for the IMEIToModel service, which can decode IMEI numbers and verify their validity.
Initialization
from models.imeitomodel.imeitomodel import IMEIToModel
# Initialize client (uses environment variables IMEITOMODEL_ACC_NO and IMEITOMODEL_SEC)
imei_to_model = IMEIToModel()
# Use test mode
imei_to_model = IMEIToModel(use_test=True)
Get Data
# Get device model information
imei = "123456789012345"
model_result = imei_to_model.get_data(imei, 'GETMODEL')
print(model_result)
# Check IMEI validity
valid_result = imei_to_model.get_data(imei, 'CHECKVALID')
print(valid_result)
Car APIs
Carsxe
File: models/vehicle/carsxe/carsxe.py
This module provides a client for the Carsxe API, which offers comprehensive vehicle information.
Initialization
from models.vehicle.carsxe.carsxe import Carsxe
# Initialize with API key from environment variable
carsxe = Carsxe() # Uses CARSXE_API_KEY from environment
Get Car Specifications by VIN
# Get car specifications by VIN
vin = "WBAFR7C57CC811956"
car_specs = carsxe.get_car_specs(vin, format='json', deepdata=1)
print(car_specs)
Get Car Information by License Plate
# Get car information by license plate
plate = "7XER187"
country = "US"
state = "CA"
car_by_plate = carsxe.get_car_by_plate(plate, country, state)
print(car_by_plate)
Get Car Images
# Get car images
car_images = carsxe.get_car_images(
make='toyota',
model='tacoma',
year='2018',
color='blue',
format='json'
)
print(car_images)
Get Market Value
# Get market value by VIN
vin = "WBAFR7C57CC811956"
market_value = carsxe.get_market_value(vin, format='json')
print(market_value)
Get Vehicle History
# Get vehicle history by VIN
vehicle_history = carsxe.get_vehicle_history(vin, format='json')
print(vehicle_history)
Car Identification by Image
# Identify car by image URL
image_url = "https://example.com/car_image.jpg"
car_identified = carsxe.identify_car_by_image(image_url)
print(car_identified)
License Plate Recognition
# Recognize license plate from image
plate_image_url = "https://example.com/plate_image.jpg"
recognized_plate = carsxe.recognize_license_plate(plate_image_url)
print(recognized_plate)
VehicleDatabase
File: models/vehicle/vehicle_database/vdb.py
This module provides a client for the VehicleDatabase API, offering comprehensive vehicle data services.
Initialization
from models.vehicle.vehicle_database.vdb import VehicleDatabase
# Initialize with API key from environment variable
vehicle_db = VehicleDatabase() # Uses VDB_API_KEY from environment
# Or specify API key directly
vehicle_db = VehicleDatabase(api_key="your_api_key_here")
VIN Decoding
# Basic VIN decode
vin = "1HGCM82633A123456"
vin_decode_data = vehicle_db.vin_decode(vin)
print(vin_decode_data)
# Premium VIN decode
premium_data = vehicle_db.premium_vin_decode(vin)
print(premium_data)
# Advanced VIN decode (single trim)
advanced_data = vehicle_db.premium_plus_vin_decode_single_trim(vin)
print(advanced_data)
# Advanced VIN decode (multiple trims)
all_trims_data = vehicle_db.premium_plus_vin_decode_multiple_trims(vin)
print(all_trims_data)
Auction Information
# Get auction information for a VIN
auction_data = vehicle_db.auction(vin)
print(auction_data)
Market Value
# Get market value by VIN
market_value = vehicle_db.market_value_by_vin(vin, state="CA", mileage="50000")
print(market_value)
# Get market value by year/make/model
year = "2022"
make = "Toyota"
model = "Camry"
ymm_value = vehicle_db.market_value_by_ymm(year, make, model, state="CA", mileage="35000")
print(ymm_value)
Vehicle History
# Get sales history
sales_history = vehicle_db.sales_history(vin)
print(sales_history)
# Get title check
title_check = vehicle_db.title_check(vin)
print(title_check)
License Plate Decoding
# Decode US license plate
license_plate = "ABC123"
state = "CA"
plate_info = vehicle_db.us_plate_decode(license_plate, state)
print(plate_info)
# Decode UK registration
uk_reg_num = "AB12CDE"
uk_reg_info = vehicle_db.uk_registration_decode(uk_reg_num)
print(uk_reg_info)
Image Processing
# OCR for license plates
plate_image_path = "path_to_license_plate_image.jpg"
plate_ocr = vehicle_db.license_plate_ocr(plate_image_path)
print(plate_ocr)
# OCR for VIN
vin_image_path = "path_to_vin_image.jpg"
vin_ocr = vehicle_db.vin_ocr(vin_image_path)
print(vin_ocr)
Vehicle Maintenance and Warranty
# Get vehicle maintenance information
maintenance_info = vehicle_db.vehicle_maintenance(year, make, model)
print(maintenance_info)
# Get vehicle warranty information
warranty_info = vehicle_db.vehicle_warranty(year, make, model)
print(warranty_info)
# Get vehicle repair information
repair_info = vehicle_db.vehicle_repairs(year, make, model)
print(repair_info)
# Get vehicle recall information
recall_info = vehicle_db.vehicle_recalls(year, make, model)
print(recall_info)
ApiCar
File: models/vehicle/apicar/apicar.py
This module provides a client for the ApiCar service, which offers information about vehicle auctions and listings.
Initialization
from models.vehicle.apicar.apicar import ApiCar
# Initialize with API key from environment variable
api_car = ApiCar() # Uses API_CAR_TOKEN from environment
# Or specify API key directly
api_car = ApiCar(api_key="your_api_key_here")
Get Current Lots
# Get current lots with optional filters
current_lots = api_car.get_current_lots(
make="Toyota",
model="Camry",
year_from=2018,
year_to=2023
)
print(current_lots)
Get Lot by ID
# Get details for a specific lot
lot_id = "123456"
lot_details = api_car.get_lot_by_id(lot_id)
print(lot_details)
Get Current Bid
# Get current bid information
lot_id = "123456"
site = "copart" # or "iaai"
bid_info = api_car.get_current_bid(lot_id, site)
print(bid_info)
Get History Cars
# Get historical data for cars
make = "Toyota"
model = "Camry"
history_cars = api_car.get_history_cars(
make=make,
model=model,
year_from=2018,
year_to=2023
)
print(history_cars)
Get Sale History
# Get sale history by VIN
vin = "1HGCM82633A123456"
sale_history = api_car.get_sale_history_by_vin(vin)
print(sale_history)
# Get sale history by lot ID
lot_id = "123456"
site = "copart" # or "iaai"
lot_sale_history = api_car.get_sale_history_by_lot_id(lot_id, site)
print(lot_sale_history)
CopartAPI
File: models/vehicle/copart_iaai/copart_api.py
This module provides a client for the Copart and Insurance Auto Auctions (IAAI) API.
Initialization
from models.vehicle.copart_iaai.copart_api import CopartAPI
# Initialize with API key from environment variable
copart_api = CopartAPI() # Uses COPART_IAAI_API from environment
# Or specify API key directly
copart_api = CopartAPI(api_token="your_api_token_here")
Get Car by VIN
# Get car information by VIN
vin_number = "1HGCM82633A123456"
car_info = copart_api.get_car_by_vin(vin_number)
print(car_info)
Get Car by Lot Number
# Get car information by lot number
lot_number = "123456"
car_info = copart_api.get_car_by_lot_number(lot_number)
print(car_info)
Get Buy Now Cars
# Get cars available for immediate purchase
buy_now_cars = copart_api.buy_now_cars(
make="Toyota",
model="Camry",
year_from=2018,
year_to=2023
)
print(buy_now_cars)
Get Car Count History
# Get count history for a VIN
vin_number = "1HGCM82633A123456"
count_history = copart_api.get_car_count_history(vin_number)
print(count_history)
Get Makes and Models
# Get list of makes
makes = copart_api.get_makes()
print(makes)
# Get list of models
models = copart_api.get_models()
print(models)
# Get models for a specific make
make_id = 123
models_by_make = copart_api.get_model_by_make_id(make_id)
print(models_by_make)
Get Active Lots
# Get active lots
active_lots = copart_api.get_active_lots(
make="Toyota",
model="Camry",
year_from=2018,
year_to=2023
)
print(active_lots)
VIN Decoding
# Decode a VIN
vin = "1HGCM82633A123456"
vin_data = copart_api.vin_decoding(vin)
print(vin_data)
CCarFax
File: models/vehicle/carfax/ccarfax.py
This module provides a client for the CheapCarfax service, which offers access to vehicle history reports.
Initialization
from models.vehicle.carfax.ccarfax import CCarFax
# Initialize with API key from environment variable
carfax_client = CCarFax() # Uses CHEAP_CARFAX_KEY from environment
Get User Information
# Get user account information
user_info = carfax_client.get_user_information()
print(user_info)
Get User Limits
# Get user account limits
user_limits = carfax_client.get_user_limits_information()
print(user_limits)
Fetch Report
# Fetch a Carfax report for a VIN
vin = "1HGCM82633A123456"
filename = f"carfax_report_{vin}.pdf"
carfax_report_status = carfax_client.fetch_and_save_report('carfax', vin, filename)
print(carfax_report_status)
# Fetch an Autocheck report for a VIN
autocheck_report_status = carfax_client.fetch_and_save_report('autocheck', vin, f"autocheck_report_{vin}.pdf")
print(autocheck_report_status)
Motorcycle APIs
APINinjaMotorcyclesAPI
File: models/vehicle/apininja/motorcycle.py
This module provides a client for the API Ninja Motorcycles API.
Initialization
from models.vehicle.apininja.motorcycle import APINinjaMotorcyclesAPI
# Initialize with API key from environment variable
motorcycles_api = APINinjaMotorcyclesAPI() # Uses APININJA_API_KEY from environment
# Or specify API key directly
motorcycles_api = APINinjaMotorcyclesAPI(api_key="your_api_key_here")
Get Motorcycles
# Fetch motorcycles data with filters
make = "Harley"
model = "Ninja"
year = "2022"
offset = 0
motorcycles_data = motorcycles_api.get_motorcycles(
make=make,
model=model,
year=year,
offset=offset
)
print(motorcycles_data)
MApi
File: models/vehicle/vehicle_api/mapi.py
This module provides a client for the VehAPI Motorcycle API.
Initialization
from models.vehicle.vehicle_api.mapi import MApi
# Initialize with API key
moto_api = MApi(api_key="your_api_key_here")
Get Motorcycle Types
# Get all motorcycle types
moto_types = moto_api.get_moto_types()
print(moto_types)
Get Motorcycle Categories
# Get motorcycle categories
categories = moto_api.get_moto_categories()
print(categories)
Get Motorcycle Years
# Get all years
years = moto_api.get_moto_years()
print(years)
# Get years by type
moto_type = "cruiser" # Example type
years_by_type = moto_api.get_moto_years_by_type(moto_type)
print(years_by_type)
Get Motorcycle Makes and Models
# Get makes by year
year = 2022
makes = moto_api.get_moto_makes_by_year(year)
print(makes)
# Get all makes by type
moto_type = "cruiser"
all_makes = moto_api.get_all_moto_makes_by_type(moto_type)
print(all_makes)
# Get models by make
make = "Harley-Davidson"
models = moto_api.get_moto_models_by_make(make)
print(models